-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Remove redundant checked contexts around casts + more bounds checks #124184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR extends JIT assertion-based reasoning to (1) remove redundant overflow checks/casts when proven safe by range info and (2) enable additional bounds-check eliminations from inferred constant ranges.
Changes:
- Promote
RangeCheck::GetRangeFromTypeto be callable from assertion propagation, enabling range comparisons for cast redundancy decisions. - Enhance
MergeEdgeAssertionsto inferarr.Length > 0from certain non-constant index assertions. - Add range-based bounds check elimination and adjust assertion-based non-negative/non-zero inference.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/coreclr/jit/rangecheck.h | Exposes GetRangeFromType for external (assertionprop) range reasoning. |
| src/coreclr/jit/rangecheck.cpp | Improves edge-assertion merge logic, including deducing Length > 0 in more cases. |
| src/coreclr/jit/assertionprop.cpp | Uses range reasoning to remove redundant casts/overflow checks and drop more bounds checks. |
|
/azp run Fuzzlyn |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
|
PTAL @jakobbotsch @dotnet/jit-contrib |
Example of a removed checked context:
Diffs